<%--
  Created by IntelliJ IDEA.
  User: HUAWEI
  Date: 2023/11/2
  Time: 11:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--生成验证码--%>
<%--<%
    // 1.生成验证码
    String code = StringUtils.getCode(3);

    // 2.将验证码存入session中
    session.setAttribute("code", code);

    // 3.发送给浏览器
%>--%>


<html>
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
<%--    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js"></script>--%>
<%--    <script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>--%>
    <style>
        .ful {
            height: 577px;
            text-align: center;
            background: url(${pageContext.request.contextPath}/images/LoginBG2.png) no-repeat 6%;
            position: relative;
            width: 1000px;
            margin: 0 auto;
        }

        .foot {
            padding-top: 40px;
            margin-bottom: 30px;
            height: 577px;
            background: url(${pageContext.request.contextPath}/images/LoginBG1.jpg) no-repeat 50%;
            background-size: cover;
        }
    </style>
</head>
<body>
<div class=".container-fluid">

    <div class="p mb-2 bg-danger text-white">
        <div class="nav justify-content-center">
            <div class="container">
                <div class="row">
                    <div class="col">
                        <div class="nav-item">
                            <a class="navbar-brand" href="http://localhost:8080/javaweb/"
                               style="font-family: 仿宋;font-size: 30px;color: white;">新闻网</a>
                        </div>
                    </div>

                    <div class="col-2">
                        <div class="nav-item">
                            <a class="nav-link" href="#" style="font-size: 20px;color: white;">登 &nbsp;录</a>
                        </div>
                    </div>
                    <div class="col"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="foot">
        <div class="ful">
            <div class="container">
                <div class="row">
                    <div class="col-7"></div>
                    <div class="col-5">
                        <div class="shadow p-3 mb-5 bg-white rounded" style="height: 550px;margin-top: -20px">
                            <h3 style="color: red">用 户 登 录</h3>
                            <form <%--class="form-group"--%> method="post" action="login" style="margin-top: 20px">
                                <div class="container">
                                    <div class="form-group">
                                        <label for="User" style="float: left">用户名</label><label
                                            style="color:red;float: left">*</label>
                                        <input type="text" class="form-control" id="User" name="user"
                                               value="${not empty login_req_user?login_req_user:""}"><br/>
                                        <label for="password" style="float: left">密 &nbsp;&nbsp;码</label><label
                                            style="color:red;float: left">*</label>
                                        <input type="text" class="form-control" id="password" name="pwd"
                                               value="${not empty login_req_pwd?login_req_pwd:""}"><br/>
                                    </div>

                                    <div style="float: left">
                                        <label for="code" style="float: left">验证码</label><label
                                            style="color:red;float: left">*</label><br/>
                                        <input type="text" class="form-control" id="code" style="width: 250px"
                                               name="code" value="${not empty login_req_code?login_req_code:""}"><br/>
                                    </div>
                                    <div style="float: right;margin-top: 35px">
                                        <label id="label_code"><img src="${pageContext.request.contextPath}/code"
                                                                    id="sr" alt="加载中..."></label>
                                    </div>

                                    <div class="custom-control custom-checkbox custom-control-inline"
                                         style="float: left">
                                        <input type="checkbox" class="custom-control-input" id="idname" name="remember"
                                               value="1">
                                        <label for="idname" class="custom-control-label">记住密码</label>
                                    </div>
                                </div>
                                <div style="margin-top: 150px">
                                    <span style="color: red;margin-top: 18px">${login_from_info}</span>
                                    <span style="color: red;margin-top: 18px">${login_user_info}</span>
                                    <span style="color: red;">${login_code_info}</span>
                                    <input type="submit" class="btn btn-danger btn-lg btn-block" value="登 录"><br/>
                                </div>
                                <div>
                                    还没有新闻网账号？
                                    <a href="register">立即注册</a>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="../ind/footer.jsp" %>
<%--${pageContext.request.contextPath}--%>
</body>
</html>

<script>
    document.getElementById("label_code").onclick = function () {
        let img = document.getElementById("sr");
        img.src = "${pageContext.request.contextPath}/code?a=" + Math.random();
    }
</script>
